<template>
  <el-dialog :visible.sync="visible" v-dialogDrag :title="title" :close-on-click-modal="false" class="tl-dialog" width="800px" @open="open" @close="close" :append-to-body="true" :modal-append-to-body="true">
    <el-form class="tl-form" ref="form" :model="model" :rules="rules" label-width="130px" :disabled="disableEditSubmit">
			<el-row>
				<el-col :span="12">
					<el-form-item label="发起时间" prop="initiatedate">
						<el-date-picker v-model="model.initiatedate" type="date" placeholder="发起时间" value-format="yyyy-MM-dd"></el-date-picker>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="任务分类" prop="category">
						<el-select v-model="model.category" filterable clearable>
              <el-option v-for="item in codeModelFromOA.taskCategoryList" :key="'category' + item.code" :label="item.name" :value="item.code" />
            </el-select>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="12">
					<el-form-item label="任务主题" prop="taskmaintitle">
						<el-input v-model="model.taskmaintitle"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="任务内容" prop="taskdescription">
						<el-input v-model="model.taskdescription"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<!-- 发起人和记录人隐藏
			<el-row>
				<el-col :span="12">
					<el-form-item label="记录人工号" prop="usercode">
						<el-input v-model="model.usercode"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="记录人姓名" prop="username">
						<el-input v-model="model.username"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="12">
					<el-form-item label="记录人部门名称" prop="deptname">
						<el-input v-model="model.deptname"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="记录人公司名称" prop="orgname">
						<el-input v-model="model.orgname"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="12">
					<el-form-item label="发起人工号" prop="initiatorcode">
						<el-input v-model="model.initiatorcode"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="发起人姓名" prop="initiatorname">
						<el-input v-model="model.initiatorname"></el-input>
					</el-form-item>
				</el-col>
			</el-row> -->
			<el-row>
				<el-col :span="12">
					<el-form-item label="责任人工号" prop="handleusercode">
						<el-input v-model="model.handleusercode"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="责任人姓名" prop="handleusername">
						<el-input v-model="model.handleusername"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="12">
					<el-form-item label="归属信息部门名称" prop="relegationdeptname">
						<el-input v-model="model.relegationdeptname"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="归属公司名称" prop="relegationorgname">
						<el-input v-model="model.relegationorgname"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="12">
					<el-form-item label="时间要求" prop="daterequirement">
						<el-select v-model="model.daterequirement" filterable clearable>
              <el-option v-for="item in codeModelFromOA.dateRequirementList" :key="item.code" :label="item.name" :value="item.code" />
            </el-select>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="截止日期" prop="enddate">
						<el-date-picker v-model="model.enddate" type="date" placeholder="截止日期" value-format="yyyy-MM-dd"></el-date-picker>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="12">
					<el-form-item label="失败次数" prop="failedtimes">
						<el-input-number v-model="model.failedtimes" controls-position="right" :step="1" :min="0" style="width:100%"></el-input-number>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="备注" prop="description">
						<el-input v-model="model.description" type="textarea" :rows="4"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button :type="disableEditSubmit === false ? 'text' : 'primary'" @click="doCancelEdit">取消</el-button>
      <el-button type="primary" @click="doSubmitEdit" :loading="saveLoading" v-if="disableEditSubmit === false">确认</el-button>
    </div>
  </el-dialog>
</template>

<script>
/** mixins */
import { mixin_edit } from '@tapui/mixins/mixin_edit'
/** 子组件 */
/** 工具类 */
import { putAction, getAction, postAction, deleteAction } from '@tapui/utils/http'
/** VUE配置 */
export default {
  mixins: [mixin_edit],
  components: { },
  data() {
    return {
      moduleTitle: '待下发任务项',
      urlPrefix: '/meet/taskDetail/',
      url: {
				// 额外的url
				dataCodeList: '/meet/taskDetail/dataCodeList'
			},
			codeModelFromOA: {}
    }
	},
  methods: {
    loaded() {
      // 页面加载完毕执行
		},
		/** 查询编码列表 */
    queryDataCodeList() {
      if (this.url.dataCodeList) {
        getAction(this.url.dataCodeList, {}).then((res) => {
          if (res.success) {
            this.codeModelFromOA = res.result
          } else {
            this.$tap.alert(res.message, "warning")
          }
        })
      }
    }
	},
	created() {
		// 查询编码值
    this.queryDataCodeList()
  }
}
</script>

